package com.yunhe.energy.client.fallback;

import com.yunhe.energy.client.OptionClient;
import com.yunhe.common.model.ResultObject;
import com.yunhe.common.model.data.Price;
import com.yunhe.common.util.FallbackUtil;
import feign.hystrix.FallbackFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * @author liuronglei
 */
@Component
public class OptionFallbackFactory implements FallbackFactory<OptionClient> {
    @Override
    public OptionClient create(Throwable arg0) {
        return new OptionClient() {

            @Override
            public ResponseEntity<ResultObject<List<Price>>> getPrices(Long areaCode, Long typeCode, List<Date> dtime) {
                return FallbackUtil.getDefaultFallBack();
            }
        };
    }
}
